# Description: add "Selected" config option
# Author: Fernando Vezzosi <fv@linuxvar.it>

Index: gmrun-0.9.2/src/main.cc
===================================================================
--- gmrun-0.9.2.orig/src/main.cc	2010-02-03 12:37:52.455767905 +0800
+++ gmrun-0.9.2/src/main.cc	2010-02-03 12:38:46.801743816 +0800
@@ -615,6 +615,10 @@
   if (!configuration.get_int("ShowLast", shows_last_history_item)) {
     shows_last_history_item = 0;
   }
+  int last_history_selected = 0;
+  if (!configuration.get_int("Selected", last_history_selected)) {
+    last_history_selected = 1;
+  }
   if (shows_last_history_item) {
     gtk_completion_line_last_history_item(GTK_COMPLETION_LINE(compline));
   }
@@ -662,7 +666,11 @@
 
   gtk_widget_show(win);
 
-  gtk_window_set_focus(GTK_WINDOW(win), compline);
+  if(last_history_selected){
+    gtk_entry_select_region(GTK_ENTRY(compline), 0, strlen(gtk_entry_get_text(GTK_ENTRY(compline))));
+  }else{
+    gtk_entry_set_position(GTK_ENTRY(compline), -1);
+  }
 
   gtk_main();
 }
